package org.harryrose.resultkit.writers;

import java.io.File;

import org.harryrose.resultkit.converters.DataConverter;
import org.harryrose.resultkit.exceptions.CannotWriteException;
import org.harryrose.resultkit.exceptions.TypeException;

public abstract class ResultWriter {
	
	/**
	 * Writes a scalar to disk.
	 * @param directory Directory in which to store the variable.
	 * @param variableName The name of the file.
	 * @param value The value to store in the file.
	 * @throws CannotWriteException
	 */
	public abstract void write(File directory, String variableName, Object value) throws CannotWriteException, TypeException;
	
	public abstract <T> void write(File directory, String variableName, Object value, DataConverter<T> converter) throws CannotWriteException, TypeException;
	/**
	 * Writes a 1D array to disk.
	 * @param directory Directory in which to store the variable.
	 * @param variableName The name of the file.
	 * @param array The value to store in the file.
	 * @throws CannotWriteException
	 */
	public abstract void write(File directory, String variableName, Object[] array) throws CannotWriteException, TypeException;
	public abstract <T> void write(File directory, String variableName, Object[] array,DataConverter<T> converter) throws CannotWriteException, TypeException;
	
	/**
	 * Writes a 2D array to disk.
	 * @param directory Directory in which to store the variable.
	 * @param variableName The name of the file.
	 * @param array The value to store in the file.
	 * @throws CannotWriteException
	 */
	public abstract void write(File directory, String variableName, Object[][] array) throws CannotWriteException, TypeException;
	
	public abstract <T> void write(File directory, String variableName, Object[][] array, DataConverter<T> converter) throws CannotWriteException, TypeException;
}
